import java.util.Scanner;

public class Login {
    public static String name = "zhangsan";
    public static String pwd = "123456";

    public static void login(String name,String password) {
        if(!Login.name.equals(name)) {
            throw new NameException("用户名输入有误！");
        }
        if(!Login.pwd.equals(password)) {
            throw new PwdException("密码输入有误！");
        }
        System.out.println("登录成功！");
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名：");
        String inname = scanner.nextLine();
        System.out.println("请输入密码：");
        String inpwd = scanner.nextLine();
        login(inname,inpwd);
    }
}
